package com.caochenlei.graph;

public class DigraphTest {
    public static void main(String[] args) {
        Digraph D = new Digraph(13);
        D.addEdge(4, 2);
        D.addEdge(2, 3);
        D.addEdge(3, 2);
        D.addEdge(6, 0);
        D.addEdge(0, 1);
        D.addEdge(2, 0);
        D.addEdge(11, 12);
        D.addEdge(12, 9);
        D.addEdge(9, 10);
        D.addEdge(9, 11);
        D.addEdge(8, 9);
        D.addEdge(10, 12);
        D.addEdge(11, 4);
        D.addEdge(4, 3);
        D.addEdge(3, 5);
        D.addEdge(7, 8);
        D.addEdge(8, 7);
        D.addEdge(5, 4);
        D.addEdge(0, 5);
        D.addEdge(6, 4);
        D.addEdge(6, 9);
        D.addEdge(7, 6);

        System.out.println("获取D的大小：" + D.size());
        System.out.println("获取D的边数：" + D.edge());
        System.out.println("====================");
        for (int v = 0; v < D.size(); v++) {
            System.out.println("获取D中" + v + "的邻点：" + D.adj(v));
        }
        System.out.println("====================");
        System.out.println(D);

        Digraph R = D.reverse();
        System.out.println("获取R的大小：" + R.size());
        System.out.println("获取R的边数：" + R.edge());
        System.out.println("====================");
        for (int v = 0; v < R.size(); v++) {
            System.out.println("获取R中" + v + "的邻点：" + R.adj(v));
        }
        System.out.println("====================");
        System.out.println(R);
    }
}
